# Volume 3 – Kernel Builder Specification
# ---------------------------------------
# 1) Pivot function (canonical)
#    Use linear g(D) = a·D + b loaded from pivot_params.json.
#    Constraints: g(2) = 1 (abs err ≤ 1e-6); a < 0; g monotone decreasing on D∈[1,3].
#    Do not re-derive g inline; always load (a,b).

# 2) Tridiagonal kernel construction (analytic mode)
#    For a given D at context n, and N states:
#      M[i,i]   = D - 2*g(D)            (if N>1; else M[0,0]=D)
#      M[i,i+1] = g(D)  (i<N-1)
#      M[i,i-1] = g(D)  (i>0)
#    Zero elsewhere. The order of n in D_values defines row/col order.

# 3) Empirical kernel construction (rates mode)
#    Given row-stochastic P(n): M(n) = D(n) · P(n) after row-sum sanity (1±1e-12).
